using System;
using System.Collections.Generic;
using System.IO;

namespace PeDALS.Tools.AZ.PSTArchive.PSTData
{
    public class PSTDensityList
    {
        private byte mbFlags;
        private byte mcEntDensityList;
        private short mwPadding;
        private int mulCurrentPage;
        private List<PSTDensityListPage> mrgDListPageEnt = new List<PSTDensityListPage>();
        private PSTPageTrailer mptTrailer;

        public PSTDensityList(BinaryReader brReader, bool blnUnicode)
        {
            mbFlags = brReader.ReadByte();
            mcEntDensityList = brReader.ReadByte();
            mwPadding = brReader.ReadInt16();
            mulCurrentPage = brReader.ReadInt32();
            PSTDensityListPage pdlpPage;
            for (int intI = 1; intI <= (122 + (blnUnicode ? 0 : 1)); intI++)
            {
                int intPageInformation = brReader.ReadInt32();
                pdlpPage = new PSTDensityListPage();
                pdlpPage.dwPageNumber = Convert.ToInt32(intPageInformation & 0xfffff);
                pdlpPage.dwFreeSlots = Convert.ToInt32(intPageInformation >> 20);
                mrgDListPageEnt.Add(pdlpPage);
            }
            mptTrailer = new PSTPageTrailer(brReader, blnUnicode);
        }

        public byte bFlags
        {
            get
            {
                return mbFlags;
            }
            set
            {
                mbFlags = value;
            }
        }

        public byte cEntDensityList
        {
            get
            {
                return mcEntDensityList;
            }
            set
            {
                mcEntDensityList = value;
            }
        }

        public short wPadding
        {
            get
            {
                return mwPadding;
            }
            set
            {
                mwPadding = value;
            }
        }

        public int ulCurrentPage
        {
            get
            {
                return mulCurrentPage;
            }
            set
            {
                mulCurrentPage = value;
            }
        }

        public List<PSTDensityListPage> rgDListPageEnt
        {
            get
            {
                return mrgDListPageEnt;
            }
            set
            {
                mrgDListPageEnt = value;
            }
        }

        public PSTPageTrailer PageTrailer
        {
            get
            {
                return mptTrailer;
            }
            set
            {
                mptTrailer = value;
            }
        }
    }
}